import { request } from '@/utils/request'
//根据角色id获取角色名称
export function getRoleName (roleId) {
  return request({
    url: '/api/role/getRoleName?roleId=' + roleId,
    method: 'get'
  })
}

//根据角色id获取角色权限
export function getRoleAuth (roleId) {
  return request({
    url: '/api/role/getRoleAuth?roleId=' + roleId,
    method: 'get'
  })
}

//请求获取所有角色
export function getAllRole () {
  return request({
    url: '/api/role/list',
    method: 'get'
  })
}

//请求获取所有角色,带分页
export function getAllRoles (pageNum, pageSize) {
  return request({
    url: '/api/role/getAllRole?pageNum=' + pageNum + '&pageSize=' + pageSize,
    method: 'get'
  })
}

//删除某一角色
export function deleteRole (roleId) {
  return request({
    url: '/api/role/delete?roleId=' + roleId,
    method: 'delete'
  })
}

//添加角色
export function addRole (params) {
  return request({
    url: '/api/role/add',
    method: 'post',
    data: params,
  })
}

//更新角色、设置角色权限
export function setRole (params) {
  return request({
    url: '/api/role/update',
    method: 'put',
    data: params,
  })
}

